package com.yidu.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.yidu.bean.TbMember;
import com.yidu.dao.TbMemberMapper;
import com.yidu.message.Page;
import com.yidu.message.Pages;
import com.yidu.service.TbMemberService;

/**
 * 类的描述-- 用户接口 实现类
 * @author 楠竹
 * @date 2018年7月12日
 * @version 1.0
 */
@Service
public class TbMemberImpl implements TbMemberService {
	
	Logger logger = Logger.getLogger(TbMemberImpl.class);
	
	@Resource
	private TbMemberMapper memberDao; 

	/* (non-Javadoc)
	 * @see com.yidu.service.TbMemberService#delete(java.lang.String)
	 */
	@Override
	public int delete(String memId) {
		logger.info("进入删除方法...");
		int num = memberDao.deleteByPrimaryKey(memId);
		
		
		return num;
		
	}

	/* (non-Javadoc)
	 * @see com.yidu.service.TbMemberService#save(com.yidu.bean.TbMember)
	 */
	@Override
	public int save(TbMember mem) {
		logger.info("进入增加方法...");
		int save = memberDao.insertSelective(mem);
		return save;
	}

	/* (non-Javadoc)
	 * @see com.yidu.service.TbMemberService#update(com.yidu.bean.TbMember)
	 */
	@Override
	public int update(TbMember mem) {
		logger.info("进入修改方法...");
		int s = memberDao.updateByPrimaryKeySelective(mem);
		return s;
	}

	/* (non-Javadoc)
	 * @see com.yidu.service.TbMemberService#findVague(com.yidu.message.Page, com.yidu.bean.TbMember)
	 */
	@Override
	public List<TbMember> findVague(Pages pages, TbMember mem) { 
		logger.info("进入模糊查询");
		List<TbMember> list = memberDao.findVague(pages, mem);
		
		return list;
	}

	

	@Override
	public long findCount(TbMember mem) {
		long lon = memberDao.findCount(mem);
		return lon;
	}

	@Override
	public List<TbMember> findByName(TbMember mem) {
		return memberDao.findByName(mem);
	}

	@Override
	public int islogin(TbMember mem) {
		System.out.println("进入判断登录方法");
		return memberDao.islogin(mem);
		
	}

	@Override
	public TbMember findById(String memId) {
		logger.info("进入根据ID查询...");
	TbMember mem = memberDao.selectByPrimaryKey(memId);
		return mem;
	}

	 
	@Override
	public TbMember findMemName(String memName) {
		return memberDao.findMemName(memName);
	}

}
